$(document).ready(function(){
	$("#btnAccept").click(function(e){
		e.preventDefault();
		var amount = $("#trfAmount").val();
		if(jQuery.isNumeric(amount)){
			$('<div>Are you sure?</div>').dialog({
				title: "Transfer confirmation",
		        resizable: false,
		        buttons: {
		            "Yes": function() {
						url = "includes/transfers_control.php";
						data = $('#formTransfers').serialize();
						$.post(url, data, function(data){
							$('<div>'+data+'</div>').dialog({
						        resizable: false,
						        buttons: {
									"Ok": function() {
						                $(this).dialog("close");
						                loadTemplate('includes/account_template.php', 'account', 0);
						                connect('account');
						            }
								}
							});
						});
		                $(this).dialog("close");
		            },
		            "No": function() {
		                $(this).dialog("close");
		            }
		        }
		    });
		}else{
			$('<div>Amount should be a number</div>').dialog({
				title: "Attention!",
		        resizable: false,
		        buttons: {
					"Ok": function() {
						$(this).dialog("close");
		            }
				}
			});
		}
	});
});